package com.zhihui.service;

/**
 * Created by hengxing on 2017/9/11.
 */

import com.github.pagehelper.PageHelper;
import com.zhihui.mapper.SystemRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/role")
public class SystemRoleApi {


   /* @Autowired
    private SystemUserService systemUserService;
*/

   @Autowired
   private SystemRoleMapper systemRoleMapper;



    @RequestMapping("/roleList")
    @ResponseBody
    public Object queryUserList(){
        return systemRoleMapper.queryAllRole();
    }




    @RequestMapping("/roleList/countnum")
    @ResponseBody
    public Object queryUserListTest1(@RequestParam int pagenum,@RequestParam int pagesize){

        Map<String,Object>  params=new HashMap<String,Object>();
        params.put("offset",pagenum);
        params.put("pagesize",pagesize);
        return systemRoleMapper.queryOrderLog(params);
    }




    @RequestMapping("/roleList/count2num")
    @ResponseBody
    public Object queryUserListTest2(@RequestParam int pagenum,@RequestParam int pagesize){

        PageHelper.startPage(pagenum,pagesize);
        List<Map<String,Object>> resultList=systemRoleMapper.queryByPageHelper();
        return resultList;
    }





}
